layui.use(['element','form','table','upload'],function(){
    var upload = layui.upload;
    var table = layui.table;
    var form = layui.form;

    table.render({
        elem: '#demo'
        ,toolbar: '#toolbarDemo'
        ,url: '/copWarehouse/user' //数据接口
        ,page: true //开启分页
        ,cols: [[ //表头
            {field: 'warehouseId',title: '库存编号', sort: true, width:120}
            ,{field: 'companyNumber', title: '公司编号', sort: true, width:120}
            ,{field: 'companyName',title: '公司名'}
            ,{field: 'productNumber', title: '贵金属编号', sort: true, width:120}
            ,{field: 'productName',title: '贵金属名'}
            ,{field: 'departmentName',title: '部门名'}
            ,{field: 'metalSize', title: '库存数量'}
        ]]
        ,id : "warehouse"
    });

    //头部工具栏监听事件--增加
    table.on('toolbar(test)', function(obj){
        var checkStatus = table.checkStatus(obj.config.id);
        switch(obj.event){
            case 'transfer':
                window.location.href="/product/productTransfer.html"
                break;
        };
    });

});